/**
 *
 */
package com.monkeyboy.controller;

import com.monkeyboy.common.dto.ResData;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @Description
 *
 * @author Gavin<br>
 *         2019年8月24日
 */
@ControllerAdvice
public class ControllerExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public ResData handleGlobalException(Exception ex) {
        ex.printStackTrace();
        return ResData.ERROR_500("网络繁忙，请稍后重试。");
    }
}
